package com.woniuxy.student.controller;

import com.woniuxy.commons.entity.ErrorSheet;
import com.woniuxy.commons.entity.QuestionAnswer;
import com.woniuxy.commons.entity.QuestionDetail;
import com.woniuxy.commons.entity.ResponseEntity;
import com.woniuxy.commons.entity.wyh.TeacherInfo;
import com.woniuxy.student.service.ErrorQuestionService;
import com.woniuxy.student.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Collections;
import java.util.List;

/**
 * @Author: lishuwei
 * @Date: 2020/7/18
 * @description:
 */
@RestController
@RequestMapping("/ErrorQuestionController")
public class ErrorQuestionController {
    @Autowired
    private ErrorQuestionService errorQuestionService;
    @GetMapping("/getErrorQuestion/{id}/{type}")
//    @PathVariable("id") int id
    public ResponseEntity<Object> getInterlocutors(@PathVariable("id") int id,@PathVariable("type") int type){
        //获取当前用户，判断用户角色，用学生（老师）ID查询问答记录

        ResponseEntity<Object> responseEntity=new ResponseEntity<>();
        try {
            List<ErrorSheet> errorSheets=errorQuestionService.getErrorQuestion(id,type);


            responseEntity.setCode(200);
            responseEntity.setData(errorSheets);
            return responseEntity;
        }catch (Exception e){
            e.printStackTrace();
            responseEntity.setCode(400);
            responseEntity.setMsg("服务器维护中请稍后");
        }
        return responseEntity;
    }



}
